package com.lvcoding.shizhan.common.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.Customizer;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;

/**
 * @author wuyanshen
 */
@Configuration
public class CustomResourceServerConfigurerAdapter extends ResourceServerConfigurerAdapter {

    @Override
    public void configure(HttpSecurity http) throws Exception {
        // @formatter:off
        http
                .authorizeRequests()
                .antMatchers("/error", "/code/**").permitAll()
                .anyRequest().authenticated()
                .and()
                .cors(Customizer.withDefaults());
        // @formatter:on
    }

}
